{template "designer","header"}
<div id="sjs_main">
	{template "designer","left"}
	   <script type="text/javascript">
   		function add_message(){
   			var name = $('#name').val();
   			var phone = $('#phone').val();
   			var content = $('#content').val();
   			var code = $('#code').val();
   			if(name==''){
   				alert('请填写联系人名字');
   				return false;
   			}
   			if(phone==''){
   				alert('请填写联系电话');
   				return false;
   			}
   			if(content==''){
   				alert('请填写咨询内容');
   				return false;
   			}
   			if(code==''){
   				alert('请填写验证码');
   				return false;
   			}
   		}
   		function reply(id){
   			var content = $('#rcontent'+id).val();
   			if(content==''){
   				alert('请填写回复内容');
   				$('#rcontent').focus();
   				return false;
   			}else if(content.length>255){	
   				alert('回复的内容不能超过255个字符');	
   				return false;
   			}
   				$.post("index.php?m=content&c=designer&a=reply_message", {
   				content :content,
   				messageid:id,
   				dosubmit:1
   				
   			}, function(data) {
   					if(data.id>0){
   						var html = '<span class="span01">回答:</span><span class="span02">	'+data.content+'</span>';
   						$('#noreply'+data.id).html(html);
   						$('#reply_box'+data.id).hide();
   						$('#replyword'+data.id).hide();
   						alert('回复成功');
   						return false;
   					}else{
   						alert('回复失败请重试');
   						return false;
   					}
   					
   			
   				
   			}, "json");
   			}
   			function replyit(id){
   				var d = document.getElementById('reply_box'+id).style.display;
   				if(d=='none'){
   					$('#reply_box'+id).show();
   				}else{
   					$('#reply_box'+id).hide();
   				}
   				
   			}
   </script>
<div class="right">
		<div class="r01_title"><span><a href="#">首页</a>><a href="#">留言咨询</a></span></div>
		<div class="tittle05 colorgreen" style="margin-bottom:30px;">留言咨询：</div>	
		
	  <div class="r02_content02">
			<div class="lyzx">
			<form action="index.php?m=content&c=designer&a=message" method="post">
				<input type="hidden" value="{$_GET['designerid']}" name="designerid">
				<span><label>联系人：</label><input name="name" id="name" type="text" class="k" /></span>
				<span><label>联系方式：</label><input name="phone" id="phone" type="text" class="k" />&nbsp; （仅提供给伱所留言的公司查询）</span>
				<span><label>咨询内容：</label><textarea name="content" id="content" cols="" rows="" class="k1"></textarea></span>
				<span><label>验证码：</label><input name="code" id="code" type="text" class="k2" />　{form::checkcode('code_img', '4', '14', 84, 24)}</span>
				<input name="dosubmit" onclick="return add_message();" type="submit" style="margin-left:200px;  font:bold 14px '宋体';" class="inputbutton4" value="提交" />
				</form>
			{loop $message_data $r}
			<dl>
			<form action="">
				<dt><span><p>{if $_GET['messageid']>0}<a href="{APP_PATH}index.php?m=content&c=designer&a=message&designerid={$_GET[designerid]}">查看全部留言</a>{/if}</span></p></dt>
				<dt><span>{$r['name']}</span><tt>{date('Y-m-d H:i',$r[addtime])} </tt>{if $reply}<a onclick="return confirm('确定要删除吗?')" href="{APP_PATH}index.php?m=content&c=designer&a=del_message&designerid={$_GET[designerid]}&messageid={$r[messageid]}" class="tt01">删除</a>{if $r['rid']==''}<a href="javascript:void(0);" onclick="replyit({$r['messageid']})" class="tt01" id="replyword{$r['messageid']}">回复</a>{/if}{/if}</dt>
				<dd><span class="span01">问题:</span><span class="span02">	{$r['content']}</span>
				</dd>
				{if $r['rcontent']!=''}
				<dd class="dd01"><span class="span01">回答:</span><span class="span02">	{$r['rcontent']}</span>
				</dd>
				{else}
				<dd class="dd01" id="noreply{$r['messageid']}"><span class="span01">回答:</span><span class="span02">尚未回复</span>
				</dd>
				{/if}
				{if $r['rid']==''}
				<b style="display:none" id="reply_box{$r['messageid']}">
				<dd>
				<textarea name="" cols="" id="rcontent{$r['messageid']}" rows="" style="width:300px;"></textarea>
				</dd>
				<input name="" type="button" onclick="return reply({$r['messageid']});" class="inputbutton16 margin-left"  value="提交回复" />
				</b>
				{/if}
		</form>
			</dl>
		{/loop}
			</div>
			<div class="bottom">
				<div class="sabrosus">{$pages}</div>
				</div>
			</div>	
		
		</div>
		
	</div>
</div>

{template "designer","footer"}
